package com.aaa.controller;


import com.aaa.entity.MyReturn;
import com.aaa.entity.UserTestLogin;
import com.aaa.service.TestInsertService;
import com.aaa.util.MyTools;
import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * @author ：Lim
 * @date ：Created in 2022/7/4 19:57
 * @description：
 * @modified By：
 * @version:
 */
@Controller
@RequestMapping("testInsert")
public class TestInsertController {
    @Autowired
    private TestInsertService testInsertService;
    MyReturn myReturn = new MyReturn();

    @RequestMapping("test.do")
    @ResponseBody
    public MyReturn insertTest(String res){
        System.out.println(res);
        List<Map> maps = JSON.parseArray(res, Map.class);
        boolean b= testInsertService.testInsert(maps);
        if (b){
            return MyTools.getSuccessResult(myReturn);
        }else{
            return MyTools.getFailResult(myReturn);
        }
    }
    @RequestMapping("testsas.do")
    @ResponseBody
    public MyReturn insertSaSTest(String res){
        System.out.println(res);
        List<Map> maps = JSON.parseArray(res, Map.class);
        boolean b= testInsertService.testInsertSaS(maps);
        if (b){
            return MyTools.getSuccessResult(myReturn);
        }else{
            return MyTools.getFailResult(myReturn);
        }
    }
    @RequestMapping("testsds.do")
    @ResponseBody
    public MyReturn insertSdSTest(String res){
        System.out.println(res);
        List<Map> maps = JSON.parseArray(res, Map.class);
        boolean b= testInsertService.testInsertSdS(maps);
        if (b){
            return MyTools.getSuccessResult(myReturn);
        }else{
            return MyTools.getFailResult(myReturn);
        }
    }
}